/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package recitation;

import target.Word;
import target.WordFactory;

/**
 *
 * @author buer
 */
public class RecitationController {

    public RecitationController() {
        wordFactory = new WordFactory();
        word = wordFactory.createWord();

        jPanelTricks = new JPanelTricks(word);
        jPanelWord = new JPanelWord(word);
        WordSpy wordSpy = new WordSpy(jPanelWord, jPanelTricks);
        jPanelOperation = new JPanelOperation(word, wordSpy);
        jPanelRating = new JPanelRating(word);
        jPanelStatus = new JPanelStatus();
    }

    public JPanelOperation getjPanelOperation() {
        return jPanelOperation;
    }

    public JPanelRating getjPanelRating() {
        return jPanelRating;
    }

    public JPanelStatus getjPanelStatus() {
        return jPanelStatus;
    }

    public JPanelTricks getjPanelTricks() {
        return jPanelTricks;
    }

    public JPanelWord getjPanelWord() {
        return jPanelWord;
    }

    /**
     * 显示新单词
     */
    public void updateContent() {
        word = wordFactory.createWord();
        //word = new Word();
        //jPanelOperation.updateUI();
        jPanelRating.updateContent(word);
        //jPanelStatus.updateUI();
        jPanelTricks.updateContent(word);
        jPanelWord.updateContent(word);
        jPanelOperation.updateContent(word);
        
        // 更新WordFactory中单词统计信息，表示单词表中这个评级和状态下的单词还存在
        wordFactory.updateStatistics(word.getRating(), word.getStatus(), true);
    }
    private JPanelOperation jPanelOperation;
    private JPanelRating jPanelRating;
    private JPanelStatus jPanelStatus;
    private JPanelTricks jPanelTricks;
    private JPanelWord jPanelWord;
    private WordFactory wordFactory;
    private Word word;
}
